package com.xyzwps.mvckotlin.handler.helper

import com.xyzwps.mvckotlin.dao.model.UserInfo
import org.springframework.web.server.WebSession

internal const val USER_INFO_KEY = "userInfo"

fun WebSession.getUserInfo(): UserInfo? = this.getAttribute(USER_INFO_KEY)

fun WebSession.putUserInfo(userInfo: UserInfo) {
    this.attributes[USER_INFO_KEY] = userInfo
}

fun WebSession.clearUserInfo() {
    this.attributes.remove(USER_INFO_KEY)
}